<template>
  <div class="app-container">
    <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" @submit.native.prevent>
      <el-form-item label="UID" prop="id">
        <el-input v-model="queryParams.id" placeholder="UID" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-form-item>
    </el-form> -->

    <el-table height="50vh" v-loading="loading" :data="list" stripe border>
      <el-table-column label="序号" type="index" align="center" width="60" />
      <el-table-column label="首单时间" prop="entryTime" align="center" width="160" />
      <el-table-column label="商品名称" prop="goodsName" align="center" />
      <el-table-column label="支付现金金额" prop="payCash" align="center" width="120" />
      <el-table-column label="支付金积分金额" prop="name" align="payGold" width="180" />
      <el-table-column label="支付银积分金额" prop="paySliver" align="center" width="180" />
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  </div>
</template>

<script>
import { listPullNewOrder } from "@/api/marketing/pullnew.js";
import pullNewOrder from "./pullNewOrder.vue";

export default {
  name: "Team", //团队
  components: { pullNewOrder },
  props: {
    userId: { type: Number }
  },

  data() {
    return {
      // 列表数据
      list: [],
      // 遮罩层
      loading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: this.global.pageSize,
        id: this.userId
      },

      // 表单参数
      form: {},

    };
  },

  watch: {

    userId(n, o) {
      this.getList(n);
    }
  },

  created() {
    this.getList(this.userId);
  },

  methods: {
    getList(id) {
      this.queryParams.id = id;
      listPullNewOrder(this.queryParams).then((response) => {
        this.list = response.data;
        if (this.list.length) {
          this.total = response.total;
        }
        this.loading = false;
      });
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    }
  },
};
</script>

